Permanent magnet synchronous motor demagnetization fault diagnosis based on PCA-ISSA-PNN

Aiming at the demagnetization fault problem of the permanent magnet synchronous motor (PMSM), a demagnetization fault diagnosis method based on the combination of the principal component analysis (PCA) algorithm, the improved sparrow search algorithm (ISSA), and the probabilistic neural network (PNN) algorithm is proposed. First, the principal components of phase currents are extracted using PCA. Second, ISSA is used to optimize the smoothing coefficients of the PNN algorithm, and the optimized PNN algorithm is combined with PCA to obtain the PCA-ISSA-PNN fault diagnosis model. Finally, the established fault diagnosis model was tested using the current data collected from the experiments and compared with the fault diagnosis indexes and optimization performance of the conventional PNN, PCA-PNN, PCA-GA (genetic algorithm)-PNN, PCA-DA (dragonfly algorithm)-PNN, PCA-GTO (artificial gorilla troop optimizer)-PNN, PCA-AHA-PNN, and PCA-SSA-PNN. The test results show that the fault diagnosis accuracy of PCA-ISSA-PNN reaches 95.83%, and the fault diagnosis indexes are significantly higher than those of PNN, PCA-PNN, PCA-GA-PNN, and PCA-DA-PNN; its optimization performance is also significantly better than that of PCA-GTO-PNN, PCA-AHA-PNN, and PCA-SSA-PNN, which verifies the accuracy and efficiency of the proposed method.

instance, J. Gao et al. extracted the phase currents in the permanent magnet synchronous motor, converted the current signal from the time domain to the position domain with constant amplitude and frequency, and then used FFT analysis to diagnose demagnetization faults in both smooth and non-smooth conditions 9 .However, the process of converting the current signals proved to be complex and challenging to implement.J. Hang et al.  utilized the wavelet transform to extract fault features from the cost functions found in PMSM model predictive control (MPC) systems.They then diagnosed turn-to-turn short-circuit faults by monitoring the normalized energy-dependent eigenvectors derived from the wavelet transform coefficients 10 .However, the selection of wavelet basis functions significantly influences the results, and determining these wavelet basis functions can be challenging.An artificial intelligence-based fault diagnosis method employs intelligent classification algorithms to pinpoint faults 11 .For example, C.-S. Wang et al. can achieve the detection of demagnetization faults, bearing faults, and rotor eccentricity faults in motors by analyzing the combined features of motor torque and current signals using a one-dimensional convolutional neural network 12 .The advantage of this method is that feature extraction can extract multi-scale features from complex conditions, but the amount of experimental data used is large, and when the amount of experimental data is small, overfitting phenomena occur, so it is not applicable to small samples.X. Song et al. used the S-transform to perform time-frequency decomposition of the back EMF signal of a permanent magnet linear synchronous motor in order to extract the feature parameters, establish the feature vectors by comparing the standard deviation values and similarity of different parameters, then use the particle swarm algorithm to optimize the regularization parameter and the width of the kernel function in the least-squares support vector machine, and finally use the optimized algorithm to perform the fault diagnosis, which can accurately identify the position of the demagnetization of the motor and the degree of demagnetization 13 , but the acquisition of the back EMF signals usually involves installing additional sensors, which increases the unnecessary cost.
The probabilistic neural network (PNN) algorithm is an efficient supervised pattern classification method that has the advantages of a simple network structure, fast computational speed, high computational accuracy, good classification effect, etc.It is particularly well-suited for fault diagnosis and classification problems with small samples, and it has a wide range of applications in the field of fault diagnosis 14 .X. Dai et al. used variational modal decomposition (VMD) on PMSM current signals to find the intrinsic modal component (IMF).They then used the energy value of the IMF as the eigenvector, the fuzzy C-mean algorithm to find the clustering centers of the fault data, and the PNN to sort the faults into two groups: turn-to-turn short-circuit faults and demagnetization faults 15 .In their study, J. Ding et al. used a variational particle swarm algorithm to find the best number of decompositions and penalty factors in the VMD.They then used the sample entropy of the IMF as the feature vector and combined it with PNN to correctly classify gear faults 16 .Nagi et al. extracted the color features of glucose leaves using fuzzy color histograms, and then used the PNN algorithm to accurately classify grapevine diseases, thereby preventing yield loss 17 .However, the above study's use of empirically set smoothing coefficients in the PNN significantly impacted the diagnostic accuracy.
Based on the above research, this paper proposes a PCA-ISSA-PNN-based demagnetization fault diagnosis method to improve the accuracy of PMSM fault diagnosis and reduce its cost.This method combines feature signal extraction and artificial intelligence, using the interior PMSM as the research object.The method first uses the principal component analysis algorithm to extract the principal components of the current signal, then uses ISSA to optimize the smoothing coefficients in the PNN, and combines the optimized PNN algorithm with PCA to get the fault diagnosis model of PCA-ISSA-PNN.Finally, the established fault diagnosis model was tested using the current data collected from the experiments and compared with the fault diagnosis indexes and optimization performance of the conventional PNN, PCA-PNN, PCA-GA (genetic algorithm)-PNN, PCA-DA (dragonfly algorithm)-PNN, PCA-GTO (artificial gorilla troop optimizer)-PNN, PCA-AHA-PNN, and PCA-SSA-PNN.The test results show that the fault diagnosis accuracy of PCA-ISSA-PNN reaches 95.83%, and the fault diagnosis indexes are significantly higher than those of PNN, PCA-PNN, PCA-GA-PNN, and PCA-DA-PNN; its optimization performance is also significantly better than that of PCA-GTO-PNN, PCA-AHA-PNN, and PCA-SSA-PNN, which verifies the accuracy and efficiency of the proposed method.
The method of this paper has the following advantages compared with previous research methods: (1) The PCA-ISSA-PNN method is a fault diagnosis method that combines feature signal extraction with artificial intelligence.There is no need to establish an accurate mathematical model.(2) The PCA extraction of fault signals method has simple steps, which can reduce the data dimension and improve operational efficiency without the need for complex data conversion.(3) The method uses a small number of samples, which can improve operational efficiency.The use of current signals for diagnosis does not require the installation of additional sensors, which reduces costs.(4) The use of ISSA to optimize the smoothing coefficient in the PNN improves diagnostic accuracy.

PMSM mathematical model
The voltage equation of the PMSM on the d-q axis in the synchronous rotating coordinate system can be expressed 18 as: (1) − ω e L q i q u q = Ri q + L q di q dt − ω e (L q i q + ψ) where u d ,u q ,i d ,i q are the stator voltage and stator current of d-q, respectively.L d ,L q are the stator inductance of the d-axis and q-axis, respectively, and R is the winding resistance.ω e is the electrical angular velocity, and ψ is the magnetic chain of the permanent magnet.The electromagnetic torque equation can be expressed 18 as: where T e is the electromagnetic torque and p n is the number of pole pairs.When demagnetization of the permanent magnet occurs, the magnetic chain in the three-phase winding of the PMSM, which is generated by the no-load air-gap magnetism of the permanent magnet, can be expressed 15 as: where ψ A , ψ B , ψ C are the magnetic chains of the three-phase windings, k is a positive integer, and θ is the angle between the air-gap magnetic field axis of the permanent magnet and phase A of the motor.
The magnetic chain equation of the PMSM in the d-q axis can be expressed 15 as: where ψ d , ψ q are the magnetic chains of the d-axis and q-axis, respectively.The above model shows that when the PMSM demagnetizes, the magnetic chain changes and affects the current, allowing us to select the current signal as the fault feature vector.

Principal component analysis algorithm
Principal component analysis (PCA) is a technique commonly used to analyze large datasets and can be used to reduce high-dimensional data to the best feasible set of features [19][20][21] .PCA can significantly reduce the complexity of the neural network, thus improving the network recognition rate and prediction accuracy.Therefore, this paper uses PCA to extract data features to enhance fault diagnosis accuracy.
The specific steps of PCA are as follows: (1) Select test samples and training samples to build the initial feature matrix X as follows: where n is the number of samples and m is the initial feature dimension.(2) Calculate the correlation coefficient matrix; (3) Calculate the eigenvalues i (i = 1, • • • , m) of correlation coefficient matrix and arrange i in ascending order.Calculate the accumulative contribution h i=1 i / m i=1 i , and determine the number of principal component dimensions h.(4) Calculate the principal components.

Probabilistic neural network algorithm
Probabilistic neural network (PNN) is a feed-forward neural network model based on the Bayesian minimum risk criterion and the Parzen window function probability density estimation method proposed by Specht in 1990 14 , which has been widely used in different scientific fields 22 .The PNN method is swift and more accurate compared to other neural network methods 23 .
A PNN network usually consists of four layers: the input layer, the pattern layer, the summation layer, and the output layer 24 .The structure of PNN network is shown in Fig. 1, assuming that the input test sample is , and the output is Type i .
Layer 1 of the PNN is the input layer, which receives the feature vectors of the test samples that need to be classified for fault classification and passes them to the network.Layer 2 is the pattern layer, which is used to compute the similarity between the input feature vectors and the patterns of each category in the training set.Its input-output relationship can be determined by Eq. ( 5): (2) where x ij is the feature vector of the jth sample of the ith class in the training sample, x is the feature vector of the prediction sample, k is the sample dimension, and σ is the smoothing coefficient.Layer 3 is the summation layer, which serves to compute the probability accumulation of a particular class to obtain the probability of belonging to a particular class of faults.The summation layer is calculated by Eq. ( 6), which sums up the mode layer units in each class.
where f iN i (x) is the probability density function of x belonging to the ith class, and N i is the number of training samples in the ith class.
Layer 4 is the output layer, which serves to output the fault category of the motor.Combining Eq. ( 5) with Eq. ( 6), the formula for the probability density is obtained as: Usually, the smoothing coefficient σ in PNN is set based on experience.If it is not set properly, it will affect the accuracy of recognition.Therefore, in order to improve recognition accuracy, this paper adopts the ISSA algorithm to optimize the smoothing coefficient σ in PNN.

Improved sparrow search algorithm
The sparrow search algorithm (SSA) is an intelligent optimization algorithm proposed in 2020 to mimic the predatory and anti-predatory behavior of sparrows 25 .During sparrow foraging, sparrows are categorized into discoverers and followers 26 .Discoverers are responsible for finding and guiding the way to food areas; they have high energy and provide foraging information to the entire population.Followers, on the other hand, are lower in energy and rely on the guidance of the finders for food 27,28 .
During each iteration, the position update formula of the discoverer can be described 29 as: where t is the current iteration number, iter max is the maximum iteration number, and X t+1 i,j is the position information of the ith sparrow in the jth dimensional space .α is a uniform random number of ( 0,1] , R 2 is an alarm value of [0,1 ] , and ST is a safety value of [0.5,1 ] .Q is a random number and obeys a normal distribution, and L is a 1 × d dimensional matrix with all 1 elements.When R 2 < ST , it means that there is no predator around the population, and the discoverer can search widely for food.When R 2 ≥ ST , it means that a sparrow has discovered the predator and alarmed the police, then all sparrows have to fly quickly to a safe place to forage.The follower's position update formula can be described as: where X t+1 p is the optimal position that the discoverer is currently positioned at, and X t worst is the worst position that the discoverer is currently positioned at.A is a 1 × d dimensional matrix with elements equal only to 1 or -1 and A + = A T (AA T ) −1 26 .When i > n/2 , it means that the ith follower cannot grab food and has to go to other regions to feed.When i ≤ n/2 , it means that the follower is feeding around the optimal individual X p .
When there is a danger, the sparrow moves towards a safe area.The position update equation can be described as: (6)   www.nature.com/scientificreports/where X t best is the global optimal position, and X t worst is the worst position that the discoverer is currently positioned at.β is a parameter controlling the step size and has mean 0 and variance 1, obeying a normal distribution.K is [−1,1 ] the number of random numbers determining the direction of sparrow movement.f i is the current individual fitness value, f g is the current global optimal fitness value, f w is the current global worst fitness value, and ε is the smallest constant that avoids a denominator of zero 26 .When f i > f g , sparrows are at the edge of the population, they are more vulnerable to predation.When f i = f g , sparrows in the middle of the population realize the crisis and need to move closer to their peers to reduce the likelihood of predation.
SSA outperforms traditional optimization algorithms in terms of convergence speed, stability, and robustness 30 .However, the initial population of SSA is randomly initialized with great uncertainty, which has the disadvantages of low population diversity and making it easy to fall into local optimal solutions 31 .Therefore, the main improvement of SSA should focus on refining the population initialization 32 .The random generation of sparrows during the initialization stage makes the initial solution susceptible to aggregation, resulting in low coverage in the solution space and a low individual difference.However, the chaotic mapping initialization of the population can effectively address this issue.The circle mapping of chaos has the characteristics of randomness, uniformity, and order, which are more stable, and the coverage of the chaotic values is high.Therefore, in this paper, circle mapping is chosen to optimize the initial population to obtain the improved sparrow search algorithm (ISSA).The formula for generating the initial population by circle mapping is shown in Eq. ( 11): where n is the dimension of the solution, a and b are the control parameters, x n is the chaotic solution, and mod denotes the residual.

PMSM demagnetization fault diagnostic model
In this paper, we use the error value between the real result and the predicted result of PCA-PNN as the fitness function of ISSA, and the optimized parameters of ISSA as the smoothing coefficients of PCA-PNN.This allows us to combine the three algorithms of PCA, ISSA, and PNN, thereby improving the performance of fault diagnosis.The flowchart of the PCA-ISSA-PNN demagnetization fault diagnosis model is shown in Fig. 2. Firstly, the (10)

Experimental platform
In order to verify the accuracy of the method in this paper and to obtain the PMSM normal and faulty phase current data, the experiment is carried out using the permanent magnet synchronous motor fault experimental platform, as shown in Fig. 3.The platform mainly includes an experimental motor, a load motor, a dynamometer, a power cabinet, a frequency converter, and a control computer.The experimental motors are normal motors with 50% unipolar demagnetization and 50% overall demagnetization, for a total of three motors.The structures are interior type.The related parameters of PMSM are shown in Table 1, and the related parameters of the load motor are shown in Table 2. Power cabinet input is three-phase 380-500 V voltage, frequency is 50 Hz, output is three-phase 380-500 V voltage, the frequency is 0-320 Hz, input and output current are 46A, rated power is 22 kW.The frequency converter model is SP332201C, the rated voltage is 3300 V, the rated current is 200A, the  frequency test range is 0.1-1500 Hz, and the power is 1.5 kW.The function of the control computer is to control the platform to energize and de-energize, set the load torque, and motor speed.The data acquisition process involves the following steps: First, open the switch on the power cabinet and wait for its voltage to stabilize to 380 V. Next, the control computer activates the platform power supply; it then initiates the experimental and load motors, adjusting their rotational speeds to 500-3000 rpm and the load to a range of 1-10 N•m.Finally, the WP4000 dynamometer, with a sampling frequency of 125 kHz, collects the data.It has a voltage measurement range of 100 μV-15 kV, a current measurement range of 100 μA-15 kA, and a measurement accuracy of 0.1%.We collect data once for every 100 rpm increase in rotational speed and every 1 N•m increase in load torque.

Fault features extraction
The experiment selected 260 sets of current data under different working conditions: normal motor, 50% unipolar demagnetization, 50% overall demagnetization, motor speed range of 500-3000 rpm, load range of 1-10 nm, a total of 780 sets of data, each with an acquisition time of 0.15 s and 18,750 sample points.The current-load waterfall diagram of the PMSM for a speed of 2000 rpm and a load of 1-10 nm is shown in Fig. 4. The current waveforms of the three motors at a load of 9 Nm and a speed of 2000 rpm are shown in Fig. 5. From the figure, it can be seen that when the demagnetization fault occurs in the motor, the current will increase; the overall demagnetization 50% motor current amplitude is the largest; the unipolar demagnetization motor is the second largest; and the normal motor amplitude is the smallest.
To extract features using PCA, first create the initial matrix and calculate the correlation coefficient matrix.Second, calculate the eigenvalues corresponding to the correlation coefficient matrix and arrange them from largest to smallest, as shown in Fig. 6.Next, calculate the cumulative contribution and the contribution of individual principal components, as shown in Fig. 7. Figures 6 and 7 reveal that the subsequent principal components, after the 25th, have low eigenvalues and contribution degrees.Therefore, we can select the first 25 principal components to represent the majority of the data, with a corresponding cumulative contribution degree of 94.4%. Figure 8 shows the calculation of the last retained principal components.

Experimental results analysis
In the experiment, 220 groups of normal motor, unipolar demagnetized 50% motor, and overall demagnetized 50% motor samples are selected as training samples, and the remaining 40 groups are used as test samples, with a total of 660 groups of training samples and a total of 120 groups of test samples, and the label designations are set to be 1, 2, and 3 in order.The pattern recognition is performed by using the PNN, PCA-PNN, PCA-GA-PNN, PCA-DA-PNN, PCA-GTO-PNN, PCA-AHA-PNN, PCA-SSA-PNN, and PCA-ISSA-PNN, respectively.
From the experimental results, it can be seen that the accuracy of the PNN test set is only 70.83%, and the test set has 18 recognition errors at class 1, 13 recognition errors at class 2, and 4 recognition errors at class 3, as shown in Fig. 9.The accuracy of the PCA-PNN test set was 88.33%, and the test set showed 6 recognition errors at class 1, 5 recognition errors at class 2, and 3 recognition errors at class 3, as shown in Fig. 10.The test set's accuracy is improved by 17.5% over PNN.
The smoothing coefficient σ optimization improved the accuracy of the PCA-GA-PNN, PCA-DA-PNN, PCA-GTO-PNN, PCA-AHA-PNN, PCA-SSA-PNN, and PCA-ISSA-PNN test sets.We ran the algorithms several times each, and obtained the average iteration curves of the six algorithms, as shown in Fig. 11. Figure 11 demonstrates that both GA and DA iterations achieve local optimality, resulting in corresponding values σ of 0.7874 and 0.6456.GTO, AHA, SSA, and ISSA all reach the optimal solution, which is 0.   The parameters related to the PNN network in the eight algorithms are shown in Table 3. From Table 3, it can be seen that all the PNN networks have a 4-layer structure with 660 nodes in layer 2, 3 nodes in layer 3 and 1 node in layer 4.However, the original PNN network has 18,750 nodes in layer 1. Due to dimensionality reduction using PCA, all other 7 algorithms have 25 nodes in layer 1.In this paper, only the smoothing coefficients σ are optimized, so the values of the corresponding smoothing coefficients σ are different after using the optimized algorithms, and the accuracy of the different algorithms will be different.
The performance comparison of the six optimization algorithm models is shown in Table 4. From Table 4, it can be seen that GA and DA fall into the local optimum during optimization with average fitness of 0.075 and 0.0833, respectively, and GTO, AHA, SSA, and ISSA all reach the optimal solution with fitness of 0.4167.However, the average optimization time of ISSA is only 7.8 s, and the convergence takes place at the 3rd time on average, which is significantly lower than that of GTO, AHA, and SSA, as shown in Fig. 15, proving the high efficiency of ISSA.
A comparison of the eight algorithms is shown in Table 5.From Table 5, it can be seen that PNN has the lowest recognition accuracy, precision per class, recall per class, and F1 score.When the PCA algorithm was added, the recognition accuracy reached over 88%, the precision rate for each class reached over 82%, the recall rate for each class reached over 85%, and the F1 scores reached over 83%, which demonstrated the high efficiency of www.nature.com/scientificreports/ (1) The sample dimension of PCA after dimensionality reduction is smaller compared with the real dataset, which may lose some information, thus affecting the accuracy and recall of the model.(2) The number of samples and the length of samples selected for the experiment may not fully reflect all the information in the real dataset, so the model trained on the experimental dataset may not generalize well to the real dataset.(3) Real datasets are large and complex, and using real datasets for training and evaluation may require more computational resources and time.Experimental datasets, on the other hand, can reduce these costs to some extent.
089.The accuracy of the test set corresponding to PCA-GA-PNN is 92.5%, and the test set has 3 recognition errors in class 1, 4 recognition errors in class 2, and 2 recognition errors in class 3, as shown in Fig. 12.The accuracy of the test set corresponding to PCA-DA-PNN is 91.67%, and the test set has 4 recognition errors in class 1, 4 recognition errors in class 2, and 2 recognition errors in class 3, as shown in Fig. 13.The corresponding test set of PCA-(GTO/AHA/SSA/ISSA)-PNN has an accuracy of 95.83%, and it has 3 recognition errors in class 1, 1 recognition error in class 2, and 1 recognition error in class 3, as shown in Fig.
https://doi.org/10.1038/s41598-024-72596-5www.nature.com/scientificreports/Conclusion This paper proposes a PMSM demagnetization fault diagnosis method based on PCA-ISSA-PNN, using the interior PMSM as the research object.The established fault diagnosis model is tested and validated using the current data collected from the experiment.The validation results show that: (1) The accuracy of the PMSM fault diagnosis model based on PCA-ISSA-PNN reaches 95.83%, which is higher than the fault diagnosis accuracies of 70.83% for the PNN network, 88.33% for the PCA-PNN network model, 92.5% for the PCA-GA-PNN network model, and 91.67% for the PCA-DA-PNN network model.The accuracy of the PCA-ISSA-PNN class has higher accuracy, recall, and F1 score than them, and its fault diagnosis index is clearly optimal.(2) The PCA-ISSA-PNN-based PMSM fault diagnosis model has a significantly lower average running time and average number of convergences than PCA-GTO-PNN, PCA-AHA-PNN, and PCA-SSA-PNN.PCA-ISSA-PNN has better fault diagnosis performance.
parameters of ISSA are set: the initial number of sparrow individuals is set to 10, the number of iterations is set to 30, and the proportion of the initial discoverer is set to 20% of the number of sparrow individuals.Then it inputs the normalized training samples and test samples, uses PCA-PNN for pattern recognition, calculates the classification error, and obtains the optimized parameter of ISSA through continuous iteration.Finally, the optimized parameter is brought into the smoothing coefficient to obtain the PCA-ISSA-PNN model for testing and validation.

Table 2 .
Related parameters of load motor.

Table 3 .
Parameters associated with PNN networks in eight algorithms.

Table 4 .
Performance comparison of six optimization algorithms.

Table 5 .
Comparison results of eight algorithms.